#! /usr/bin/env python

# Alunos:   Eliezer de Souza da Silva  RA: 124065
#           Fernanda Brandao Silva     RA: 060727
#           Michel Silva Fornaciali    RA: 071884
# IA368R: Eduardo Valle - Trabalho 2

# Arquivo para plotar curvas de Precisao X Revocacaao

import sys
import matplotlib.pyplot as plt
import numpy as np

target = sys.argv[1]
target = target.split("_")[0]
rank = sys.stdin
counter = 0.0
truepos = 0.0
falsepos = 0.0
totalpos = 72.0
precision=[]
recall=[]
for candidate in rank:
	counter+=1
	candidate=candidate.split("_")[0]
	if(candidate == target):
		truepos+=1.0
	else:
		falsepos+=1.0
	
	precision.append(truepos/counter)
	recall.append(truepos/totalpos)

fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(recall,precision, color='b')
ax.set_xlabel("recall")
ax.set_ylabel("precision")
plt.show()
